using System;
using System.Configuration;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using BlogEngine.Core;

// HACK: Cultures widget
public partial class widgets_Languages_widget : WidgetBase
{

	public override string Name
	{
		get { return "Languages"; }
	}

	public override bool IsEditable
	{
		get { return false; }
	}

	public override void LoadWidget()
	{
        foreach (CultureCollectionItem item in BlogSettings.Instance.CultureFrontend)
        {
            if (item.Active)
            {
                HtmlAnchor a = new HtmlAnchor();
                a.HRef = Utils.RelativeWebRoot + item.CultureName + "/default.aspx?setculture";
                System.Globalization.CultureInfo info = System.Globalization.CultureInfo.GetCultureInfoByIetfLanguageTag(item.CultureName);
                a.InnerText = info.NativeName;

                HtmlGenericControl li = new HtmlGenericControl("li");
                li.Controls.Add(a);
                ulLanguages.Controls.Add(li);
            }
        }
	}
}
